package com.qf.dao.impl;

import com.qf.dao.EmpManagerDao;
import com.qf.entity.EmpManager;
import com.qf.util.DruidUtil;
import oracle.jrockit.jfr.jdkevents.ThrowableTracer;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/*
杨威
2021/9/16
19:19
*/
public class EmpManagerDaoImpl implements EmpManagerDao {
    QueryRunner queryRunner=new QueryRunner();
    @Override
    public EmpManager selectByName(String userName) {
        try {
            String sql="select * from empmanager where userName=?";
            EmpManager query = queryRunner.query(DruidUtil.getConnection(), sql, new BeanHandler<>(EmpManager.class), userName);
            return query;
        } catch (SQLException e) {
            throw new RuntimeException(e.getMessage()+"查询管理员出现异常");
        }
    }
}
